package com.pshcp.patient.tool;

import com.external.ws.soap.entity.dto.EinvoiceListDTO;
import com.framework.base.TwoDTO;
import com.pshcp.common.enums.PatCardTypeEnum;
import com.pshcp.domain.model.Patient;
import com.pshcp.patient.domain.searchinvoice.ao.InvoiceListAO;
import com.pshcp.patient.domain.searchinvoice.vo.InvoiceListVO;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class SearchInvoiceTools {

    public static EinvoiceListDTO buildWsEinvoiceListDTO(InvoiceListAO listAO, Patient patient){
        EinvoiceListDTO listDTO = new EinvoiceListDTO();
        listDTO.setPatCardType(PatCardTypeEnum.PAT_VISIT_CARD.getCode());
        listDTO.setPatCardNo(patient.getPatientCardNo());
        listDTO.setIdCardType(patient.getIdCardType()+"");
        listDTO.setIdCardNo(patient.getIdCardNo());
        TwoDTO<String, String> startEndTime = PatientCommonTools.buildStartEndTime(listAO.getSearchTime());
        listDTO.setStartDate(startEndTime.getOne());
        listDTO.setEndDate(startEndTime.getTwo());
        return listDTO;
    }

    public static List<InvoiceListVO> buildTestData(){
        List<InvoiceListVO> voList = new ArrayList<>();

        InvoiceListVO vo = new InvoiceListVO();
        vo.setAmount(new BigDecimal(100));
        vo.setBizNo("10001111");
        vo.setBizType(1);
        vo.setInvoiceCode("20230222001");
        vo.setInvoiceNumber("20230222001");
        vo.setCheckCode("20230222001");
        vo.setCrtTime("2023-02-22 12:22:12");
        vo.setState(1);
        vo.setVisitDate("2023-02-02");

        voList.add(vo);

        InvoiceListVO vo1 = new InvoiceListVO();
        vo1.setAmount(new BigDecimal(150));
        vo1.setBizNo("10002222");
        vo1.setBizType(2);
        vo1.setInvoiceCode("20230222002");
        vo1.setInvoiceNumber("20230222002");
        vo1.setCheckCode("20230222002");
        vo1.setCrtTime("2023-02-21 09:22:12");
        vo1.setState(0);
        vo1.setVisitDate("2023-01-22");

        voList.add(vo1);

        return voList;
    }

}
